#include "NeoCalendarHeaderModel.h"

NeoCalendarHeaderModel::NeoCalendarHeaderModel(QObject *parent)
    : QAbstractListModel(parent)
{
    mHeaderData << "Sunday" << "Monday" << "Tuesday"
                << "Wednesday" << "Thursday" << "Friday" << "Saturday";
}

NeoCalendarHeaderModel::~NeoCalendarHeaderModel() = default;

void NeoCalendarHeaderModel::setHeaderData(const QStringList &list)
{
    this->beginResetModel();
    mHeaderData = list;
    this->endResetModel();
}

int NeoCalendarHeaderModel::rowCount(const QModelIndex &parent) const
{
    return mHeaderData.size();
}

QVariant NeoCalendarHeaderModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid() || index.row() < 0 || index.row() >= mHeaderData.size())
    {
        return QVariant();
    }
    if (role == Qt::DisplayRole)
    {
        return mHeaderData.at(index.row());
    }
    return QVariant();
}